<template>
	<view class="" style="width: 100vw;height: 100vh">
		<hx-navbar title="灵感星明细" :back="true" :fixedWhiteStyle="true" :fixed="false" :color="kblackColor" barPlaceholder="hidden"
			transparent="auto">
		</hx-navbar>
		<view class="container" style="min-height: 100vh;background:#F9F9F9;">
			
			<view class="header">
			<view class="money-box cell-item-ft " @click="tiopen('hf')">
				<image class="bg-img" src="/static/aipicture/ai-diamond.png" mode="aspectFill"></image>
				<view class="dname ">
					灵感星余额：{{current}}
				</view>
			</view>
			</view>
			<view class="title-row">
				<image class="title-icon" src="@/static/aipicture/ai-child-title-icon.png"></image>
				<text class="title">灵感星明细</text>
			</view>
			<view class="content-list">
				<view class="item" v-for="item in dlist">
					<view class="item-row">
						<view class="text">{{item.diamondReason}}</view>
						<view class="count"> <text v-if="item.type==3">-</text><text v-if="item.type==4">+</text>{{item.diamondAmount}}</view>
					</view>
					<view class="subtitle">支付时间：{{item.createTime}}</view>
				</view>
			</view>
		<view class="none_box" v-if="dlist.length == 0">
						<image src="@/static/without.png" mode="widthFix"></image>
		</view>
		</view>
	
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dlist:[],
				current:'',
				hasNextPage: true,
				pageNo: 1,
				pageSize: 10,
			}
		},
		onLoad() {
			this.getAiDiamondDetail()
			this.$api.getAiDiamond(res=>{
				if(res.status){
				this.current=res.data.balance
			}
			})
		},
			onReachBottom() {
			if(this.hasNextPage){
				this.pageNo = this.pageNo + 1;
				this.getAiDiamondDetail()
			}
		},
		onPullDownRefresh() {
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		methods: {
		getAiDiamondDetail(){
			this.$api.getAiDiamondDetail(this.pageNo, res=>{
				if(res.status){
					this.dlist = this.dlist.concat(res.data.list)
					this.hasNextPage = res.data.list.length >= this.pageSize;
			}
			})
			
		
		},
		},			
	}
</script>

<style lang="scss" scoped>
	.container{
		padding: 40rpx;
	}
	.header{	
		width: 690rpx;
		height: 260rpx;
		padding: 1rpx;
		.money-box {
			width: 100%;
			height: 230rpx;
			position: relative;
			margin-bottom: 30rpx;
			padding: 0 36rpx;
		.dname{
			color: #4401A6;	z-index:2;
			font-family: Alimama ShuHeiTi;
			font-weight: bold;
			font-size: 38rpx;
		}
			 
			.img {
				width: 90rpx;
				height: 90rpx;
				border-radius: 50%;
				margin-right: 20rpx;
			}
		
			.bg-img {
				position: absolute;
				z-index: 0;
				top: 0;
				left: 0;
				width: 100%;
				height: 249rpx;
				border-radius: 20rpx;
			}
		 
		}
		// background:linear-gradient(135deg, #6C58D5 0%, #AA56D7 100%);
		.item {
			display: flex;
			flex-direction: row;
			align-items: center;
			.item-icon{
				width: 88rpx;
				height: 88rpx;
			}
			.item-title{
				margin-left:60rpx;
				color: #FFFFFF;
				font-size: 28rpx;
			}
		}
	}
	.title-row{
		display: flex;
		flex-direction: row;
		align-items: center;
		margin: 3rpx 0 30rpx 0;
		.title-icon{
			width: 40rpx;
			height: 40rpx;
		}
		.title{
			margin-left: 20rpx;
			font-size: 30rpx;
			font-weight: bold;
			color: black;
		}
	}
	.content-list{
		width: 100%;
		display: flex;
		flex-direction: column;
		background: white;
		border-radius: 20rpx;
		.item {
			padding: 20rpx 0;
			margin: 0 30rpx;
			overflow: hidden;
			background-color: #FFFFFF;
			position: relative;
			border-bottom: 2rpx #E5E5E5 solid;
			.item-row{
				display: flex;
				flex-direction: row;
				align-items: center;
				.title{
					color: black;
					font-size: 26rpx;
					font-weight: bold;
				}
				.count{
					margin-top: 20rpx;
					margin-left: auto;
					color: #7354D5;
					font-size: 30rpx;
					font-weight: bold;	
				}
			}
			.subtitle{
				font-size: 24rpx;
				color: #A3A3A3;
			}
		}
	}
	.none_box {
		width: 534rpx;
		margin: 117rpx auto;
		font-size: 32rpx;
		color: #ABA9B4;
	}
	
	.none_box image {
		width: 100%;
		height: 534rpx;
		margin-bottom: 10rpx;
	}
</style>